<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>生产计划审核</title>
    <!-- Google Font: Source Sans Pro -->
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="../dist/css/adminlte.min.css">
    <!-- overlayScrollbars -->
    <link rel="stylesheet" href="../plugins/overlayScrollbars/css/OverlayScrollbars.min.css">

</head>
<body onload="productionplan()">
    <link rel="stylesheet"  href="../css/bootstrap.min.css">
    <link rel="stylesheet"  href="../css/bootstrap-table.min.css">
    <script src="../js/jquery.min.js" ></script>
    <script src="../js/bootstrap.bundle.min.js" ></script>
    <script src="../js/bootstrap.min.js"  ></script>
    <script src="../js/bootstrap-table.min.js"  ></script>
    <script src="../js/bootstrap-table-zh-CN.min.js"></script>
    <script src="../js/index.js"></script>
    <table id="MyTable">

    </table>
    <a onclick="querydetail()">查找</a>
    <div class="modal" tabindex="-1" role="dialog" id="exampleModal">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">生产计划单</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                       计划单编号：<input class="input-group" readonly id="scjhid">
                       <table id="mytables" class="table">
                           <tr id="MyTr">
                               <th>产品编号</th>
                               <th>产品名称</th>
                               <th>描述</th>
                               <th>数量</th>
                           </tr>
                       </table>
                       <!--审核人也要修改-->
                       登记人：<input class="input-group" readonly id="register">
                       审核人：<input class="input-group" readonly id="checker">
                       <input type="submit" class="btn btn-outline-success" value="通过" onclick="ck(1)">
                       <input type="submit" class="btn btn-outline-success" value="未通过" onclick="ck(0)">
                    <textarea id="remark">

                    </textarea>
                </div>
            </div>
        </div>
    </div>
    <script>
        function ck(number) {

            var sta="";
            if (number==1){
                sta="S001-1"

            }else {
                sta="S001-2"
            }
            var name="";
            var id="";
            var num="";
            $("td input").each(function (index,item) {
                num=num+$(item).parent().next().next().next().children().val()+","
                name=name+$(item).parent().next().children().val()+","
                id=id+$(item).val()+","
            })//
          $.post("../scjh/updatescjh",{"productId":$("#productId").val(),"designer":$("#designer").val(),"checkTag":sta,"remark":$("#remark").val(),"checker":$("#checker").val(),"parentId":id,"amountUnit":num,"productName":name,"payTag":$("#user").val()},function (date) {

            },"json")
            $("#exampleModal").modal("hide")

        }
        f1();
        function f1() {
            //scjhid id='productId'
          //  $("#MyTr").nextAll().remove();
            var  tab=$("#mytables");
            $.post("../scjh/querybyids",{"parentId":$("#scjhid").val()},function (date) {
                $(date).each(function (index,item) {
                    var tr=$("<tr><td><input type='hidden' value='"+item.productId+"'>"+item.productId+"</td><td>"+item.productName+"</td><td>"+item.amount+"</td><td>"+item.productDescribe+"</td></tr>")
                    tab.append(tr)
                })
            },"json")
        }

    </script>
</body>
</html>